home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / cppsum.zip / CPPSUM.H < prev    next >
C/C++ Source or Header  |  1994-06-18  |  5KB  |  128 lines

  1. #ifndef _CPPSUM_H_
  2. #define _CPPSUM_H_
  3. /***************************************************************************
  4. *
  5. * DLL functions to get summary info from OLE 2.0 document files.
  6. *
  7. *     Copyright ⌐ 1994 Frank F Ramos, All Rights Reserved
  8. *     Send problem reports and comments to 72202.2574@compuserve.com
  9. *            
  10. * Compile using CPPSUM.H
  11. * Link using CPPSUM.LIB
  12. * CPPSUM.DLL should be placed in \WINDOWS\SYSTEM.
  13. * Example of usage:
  14. *     WORD   wInitStatus;
  15. *     HANDLE hSumInfo;
  16. *     char   szTemp[256];
  17. *     LPSTR  szFilePath;
  18. *     WORD   yr, mon, day, hr, min, sec;
  19. *     if (wInitStatus = SumInfoInit()) {
  20. *        ... loop to process files ...
  21. *           szFilePath = ...
  22. *           if (hSumInfo = SumInfoOpenFile(szFilePath)) {
  23. *              if (SumInfoGetString(hSumInfo, PID_TITLE, szTemp, 256)) {
  24. *                 ... do something with szTemp ...
  25. *              }
  26. *              if (SumInfoGetTime(hSumInfo, PID_LASTSAVED, 
  27. *                                 &yr, &mon, &day, &hr, &min, &sec)) {
  28. *                 ... do something with time ...
  29. *              }
  30. *              ...
  31. *              SumInfoCloseFile(hSumInfo);
  32. *           }
  33. *        }
  34. *        SumInfoUninit(wInitStatus);
  35. *     }
  36. *
  37. * Reasons for failure:
  38. *     SumInfoInit:     out of memory
  39. *     SumInfoOpenFile: out of memory
  40. *                      file not found
  41. *                      file is not an OLE 2.0 structured storage file
  42. *                      file does not contain OLE 2.0 summary info
  43. *                      OLE 2.0 summary info is incorrectly formatted
  44. *     SumInfoGet...  : specified property type is not available
  45. *     
  46. * Change log:
  47. * V1.4 94/06/18 Documentation changes only
  48. * V1.3 94/06/06 Change validity checking, because Excel 5.0 files
  49. *                  are slightly invalid
  50. * V1.2 94/03/01 Change STGM_SHARE_DENY_WRITE to STGM_SHARE_DENY_NONE, so
  51. *                  info can be obtained for files currently open in WinWord.
  52. * V1.1 94/01/22 Add wInitStatus parameter to SumInfoInit and SumInfoUninit,
  53. *                  to account for case where CoInitialize already called for  
  54. *                  application.
  55. *               Ensure SumInfoGetString returns zero terminated string.
  56. *               Fix minor typos in documentation.
  57. * V1.0 94/01/20 Initial version.
  58. **************************************************************************/
  59.  
  60.    /* String properties */
  61. #define PID_TITLE          0X00000002
  62. #define PID_SUBJECT        0X00000003
  63. #define PID_AUTHOR         0X00000004
  64. #define PID_KEYWORDS       0X00000005
  65. #define PID_COMMENTS       0X00000006
  66. #define PID_TEMPLATE       0X00000007
  67. #define PID_LASTAUTHOR     0X00000008
  68. #define PID_REVNUMBER      0X00000009
  69. #define PID_APPNAME        0X00000012
  70.  
  71.    /* Time properties */
  72. #define PID_TOTAL_EDITTIME 0X0000000A
  73. #define PID_LASTPRINTED    0X0000000B
  74. #define PID_CREATED        0X0000000C
  75. #define PID_LASTSAVED      0X0000000D
  76.  
  77.    /* Long properties */
  78. #define PID_PAGECOUNT      0X0000000E
  79. #define PID_WORDCOUNT      0X0000000F
  80. #define PID_CHARCOUNT      0X00000010
  81. #define PID_SECURITY       0X00000013
  82.  
  83.    /* bit masks for security long */
  84. #define AllSecurityFlagsEqNone         0
  85. #define fSecurityPassworded            1
  86. #define fSecurityRORecommended         2
  87. #define fSecurityRO                    4
  88. #define fSecurityLockedForAnnotations  8
  89.  
  90. #ifdef __cplusplus
  91. extern "C" {
  92. #endif
  93.  
  94. WORD FAR PASCAL SumInfoInit(); /* return value of non-zero indicates success 
  95.                                   return value must be passed to SumInfoUninit */
  96.  
  97. HANDLE FAR PASCAL SumInfoOpenFile(LPSTR      szPath);  /*in : file path  */
  98.                                  
  99. BOOL FAR PASCAL SumInfoGetString(HANDLE      hSumInfo, /*in : handle     */
  100.                                  DWORD       pid,      /*in : property ID*/
  101.                                  LPSTR       lpBuf,    /*out: string val */
  102.                                  int         cbBuf);   /*in : lpStr size */
  103.                                  
  104. BOOL FAR PASCAL SumInfoGetLong  (HANDLE      hSumInfo, /*in : handle     */     
  105.                                  DWORD       pid,      /*in : property ID*/
  106.                                  LPLONG      lpLong);  /*out: long val   */
  107.                                  
  108. BOOL FAR PASCAL SumInfoGetTime  (HANDLE      hSumInfo, /*in : handle     */
  109.                                  DWORD       pid,      /*in : property ID*/
  110.                                  LPWORD      lpYear,   /*out: 1980-9999  */
  111.                                  LPWORD      lpMonth,  /*out: 1-12       */
  112.                                  LPWORD      lpDay,    /*out: 1-31       */
  113.                                  LPWORD      lpHour,   /*out: 0-23       */
  114.                                  LPWORD      lpMin,    /*out: 0-59       */
  115.                                  LPWORD      lpSec);   /*out: 0-59       */
  116.                                  
  117. void FAR PASCAL SumInfoCloseFile(HANDLE     hSumInfo); /*in : handle     */
  118.  
  119. void FAR PASCAL SumInfoUninit   (WORD     wInitStatus);/*in : status from SumInfoInit*/
  120.  
  121. #ifdef __cplusplus
  122. }
  123. #endif 
  124.  
  125. #endif /* _CPPSUM_H_ */
  126.  
  127.